@nanocollective/roster 0.1.0-beta.15 → 0.1.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agents-NMGVORU3.js → agents-Q2DSTLOQ.js} +1 -1
- package/dist/{chunk-E3EVPK4I.js → chunk-JH3LQ34C.js} +16 -1
- package/dist/{chunk-QCKEGMXD.js → chunk-UEZPQ5PV.js} +2 -2
- package/dist/cli.js +64 -21
- package/dist/{compose-56JIIIHA.js → compose-H43W3QI5.js} +3 -1
- package/dist/{connectors-ZVEPXSAR.js → connectors-U5VT5W2I.js} +1 -1
- package/dist/worker/assets/assets/css/base.css +4 -0
- package/dist/worker/assets/assets/css/home.css +98 -34
- package/dist/worker/assets/assets/css/inbox.css +11 -0
- package/dist/worker/assets/assets/js/app.js +1 -0
- package/dist/worker/assets/assets/js/homesort.js +20 -0
- package/dist/worker/assets/assets/js/md.js +7 -2
- package/dist/worker/assets/assets/js/refresh.js +4 -2
- package/dist/worker/assets/assets/js/report.js +51 -0
- package/dist/worker/assets/assets/js/state.js +2 -0
- package/dist/worker/assets/assets/js/views/home.js +272 -119
- package/dist/worker/assets/assets/js/views/inbox.js +52 -11
- package/dist/worker/index.js +58 -8
- package/docs/hosting.md +2 -1
- package/docs/org-yaml.md +15 -0
- package/package.json +1 -1
- package/templates/ops/compose.mjs +20 -0
- package/templates/ops/org/operating.md +10 -0
- package/templates/ops/org/voice.md +19 -1
- package/templates/ops/prompts/daily.md +27 -6
- package/templates/ops/prompts/mention.md +3 -2
- package/templates/portal/css/base.css +4 -0
- package/templates/portal/css/home.css +98 -34
- package/templates/portal/css/inbox.css +11 -0
- package/templates/portal/js/app.js +1 -0
- package/templates/portal/js/homesort.js +20 -0
- package/templates/portal/js/md.js +7 -2
- package/templates/portal/js/refresh.js +4 -2
- package/templates/portal/js/report.js +51 -0
- package/templates/portal/js/state.js +2 -0
- package/templates/portal/js/views/home.js +272 -119
- package/templates/portal/js/views/inbox.js +52 -11
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as nodeFs from "fs";
|
|
3
3
|
import { join, dirname, resolve } from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
|
-
var { connectorsOf } = await import("./connectors-
|
|
5
|
+
var { connectorsOf } = await import("./connectors-U5VT5W2I.js").catch(() => ({ connectorsOf: () => [] }));
|
|
6
6
|
function parseYaml(text, file = "<yaml>") {
|
|
7
7
|
const lines = [];
|
|
8
8
|
text.split("\n").forEach((raw, i) => {
|
|
@@ -200,11 +200,23 @@ function readHumans(org) {
|
|
|
200
200
|
name: name || github,
|
|
201
201
|
marker: String(entry.marker ?? "").trim() || defaultMarker(name || github),
|
|
202
202
|
role: entry.role ?? void 0,
|
|
203
|
+
...handlesOf(entry.handles).length ? { handles: handlesOf(entry.handles) } : {},
|
|
203
204
|
...entry.view_only === true ? { viewOnly: true } : {}
|
|
204
205
|
});
|
|
205
206
|
}
|
|
206
207
|
return out;
|
|
207
208
|
}
|
|
209
|
+
function handlesOf(v) {
|
|
210
|
+
const list = Array.isArray(v) ? v : v ? String(v).split(",") : [];
|
|
211
|
+
return list.map((x) => String(x ?? "").trim()).filter(Boolean);
|
|
212
|
+
}
|
|
213
|
+
function handlesList(humans) {
|
|
214
|
+
if (humans.length < 2 || !humans.some((h) => h.handles?.length)) return "";
|
|
215
|
+
return humans.map((h) => {
|
|
216
|
+
const who = `- **${h.name}**${h.github ? ` (@${h.github}, label \`${h.marker}\`)` : ""}`;
|
|
217
|
+
return h.handles?.length ? `${who}: ${h.handles.join(", ")}` : `${who}: anything else`;
|
|
218
|
+
}).join("\n");
|
|
219
|
+
}
|
|
208
220
|
function humanSentence(humans) {
|
|
209
221
|
const parts = humans.map((h) => h.github ? `${h.name} (@${h.github})` : h.name);
|
|
210
222
|
if (parts.length < 2) return parts[0] ?? "";
|
|
@@ -287,6 +299,8 @@ function compose({
|
|
|
287
299
|
human_list: humanSentence(humans),
|
|
288
300
|
inflight,
|
|
289
301
|
humans_extra: humanSentence(humans.slice(1)),
|
|
302
|
+
// Who looks after what, when an org has said. Empty for one person, and the rule goes.
|
|
303
|
+
humans_handles: handlesList(humans),
|
|
290
304
|
// Who can read along and cannot rule. Empty, and the paragraph gone, when nobody is.
|
|
291
305
|
humans_viewing: humanSentence(everyone.filter((h) => h.viewOnly)),
|
|
292
306
|
// The services this staff member may use, as a list for the prompt. Empty, and the section
|
|
@@ -333,6 +347,7 @@ export {
|
|
|
333
347
|
parseYaml,
|
|
334
348
|
render,
|
|
335
349
|
readHumans,
|
|
350
|
+
handlesList,
|
|
336
351
|
humanSentence,
|
|
337
352
|
compose
|
|
338
353
|
};
|
|
@@ -490,8 +490,8 @@ async function main(argv) {
|
|
|
490
490
|
const brainsDir = at("--brains") ?? ".";
|
|
491
491
|
const handle = at("--staff");
|
|
492
492
|
const dir = resolve(at("--out") ?? join(process.env.RUNNER_TEMP ?? ".", "roster-connectors"));
|
|
493
|
-
const { parseYaml } = await import("./compose-
|
|
494
|
-
const { resolveAgent, permissionOf } = await import("./agents-
|
|
493
|
+
const { parseYaml } = await import("./compose-H43W3QI5.js");
|
|
494
|
+
const { resolveAgent, permissionOf } = await import("./agents-Q2DSTLOQ.js");
|
|
495
495
|
const org = parseYaml(readFileSync(join(opsDir, "org.yaml"), "utf8"), "org.yaml");
|
|
496
496
|
const entry = (org.staff ?? []).find((s) => s.handle === handle);
|
|
497
497
|
if (!entry) throw new Error(`no staff member "${handle}" in org.yaml`);
|
package/dist/cli.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
compose,
|
|
4
4
|
parseYaml
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JH3LQ34C.js";
|
|
6
6
|
import {
|
|
7
7
|
CATALOGUE,
|
|
8
8
|
declared,
|
|
9
9
|
secretName,
|
|
10
10
|
withConnectors
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UEZPQ5PV.js";
|
|
12
12
|
|
|
13
13
|
// src/commands/app.ts
|
|
14
14
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
@@ -1226,11 +1226,16 @@ function readHumans(org) {
|
|
|
1226
1226
|
name: name || github,
|
|
1227
1227
|
marker: String(entry.marker ?? "").trim() || defaultMarker(name || github),
|
|
1228
1228
|
role: entry.role === void 0 || entry.role === null ? void 0 : String(entry.role),
|
|
1229
|
+
...handlesOf(entry.handles).length ? { handles: handlesOf(entry.handles) } : {},
|
|
1229
1230
|
...entry.view_only === true ? { viewOnly: true } : {}
|
|
1230
1231
|
});
|
|
1231
1232
|
}
|
|
1232
1233
|
return out;
|
|
1233
1234
|
}
|
|
1235
|
+
function handlesOf(v) {
|
|
1236
|
+
const list2 = Array.isArray(v) ? v : v ? String(v).split(",") : [];
|
|
1237
|
+
return list2.map((x) => String(x ?? "").trim()).filter(Boolean);
|
|
1238
|
+
}
|
|
1234
1239
|
function staffHumans(org) {
|
|
1235
1240
|
return readHumans(org).filter((h) => !h.viewOnly);
|
|
1236
1241
|
}
|
|
@@ -3603,7 +3608,7 @@ async function deployCommand(argv) {
|
|
|
3603
3608
|
` + (config.account_id ? ` account ${config.account_id}
|
|
3604
3609
|
` : "") + ` signs in the humans in org.yaml, with GitHub
|
|
3605
3610
|
` + (exists ? "" : ` writes ${ws.opsName}/${CONFIG} and ${ws.opsName}/${WORKFLOW}
|
|
3606
|
-
`) + (config.vars.GITHUB_CLIENT_ID ? "" : " asks for the portal's GitHub OAuth App (a three-field form)\n") + (
|
|
3611
|
+
`) + (config.vars.GITHUB_CLIENT_ID ? "" : " asks for the portal's GitHub OAuth App (a three-field form)\n") + (hasConnectorStore(config) ? "" : " binds a KV namespace for connectors that sign in, such as Notion\n") + ` deploys with ${WRANGLER}, as whoever wrangler is signed in as
|
|
3607
3612
|
|
|
3608
3613
|
`
|
|
3609
3614
|
);
|
|
@@ -3639,9 +3644,9 @@ async function deployCommand(argv) {
|
|
|
3639
3644
|
assets: { ...config.assets, directory: bundle.assets }
|
|
3640
3645
|
};
|
|
3641
3646
|
writeFileSync5(join16(tmp, "wrangler.json"), JSON.stringify(full, null, 2));
|
|
3642
|
-
if (!
|
|
3643
|
-
process.stdout.write("
|
|
3644
|
-
const id = await
|
|
3647
|
+
if (!hasConnectorStore(config)) {
|
|
3648
|
+
process.stdout.write(" finding the KV namespace for signed-in connectors\u2026\n");
|
|
3649
|
+
const id = await namespaceFor(`${config.name}-connectors`, join16(tmp, "wrangler.json"));
|
|
3645
3650
|
if (id) {
|
|
3646
3651
|
config.kv_namespaces = [
|
|
3647
3652
|
...config.kv_namespaces ?? [],
|
|
@@ -3737,21 +3742,35 @@ function hasConnectorStore(config) {
|
|
|
3737
3742
|
(k) => k.binding === "CONNECTORS"
|
|
3738
3743
|
);
|
|
3739
3744
|
}
|
|
3740
|
-
async function
|
|
3741
|
-
const
|
|
3745
|
+
async function namespaceFor(title, configFile) {
|
|
3746
|
+
const listed = await captured(["kv", "namespace", "list", "--config", configFile]);
|
|
3747
|
+
if (listed.code === 0) {
|
|
3748
|
+
const found = existingNamespace(listed.text, title);
|
|
3749
|
+
if (found) return found;
|
|
3750
|
+
}
|
|
3751
|
+
const made = await captured(["kv", "namespace", "create", title, "--config", configFile]);
|
|
3752
|
+
return made.code === 0 ? namespaceId(made.text) : null;
|
|
3753
|
+
}
|
|
3754
|
+
function captured(args) {
|
|
3755
|
+
return new Promise((resolve7) => {
|
|
3742
3756
|
let text2 = "";
|
|
3743
|
-
const child = spawn(
|
|
3744
|
-
"
|
|
3745
|
-
|
|
3746
|
-
{ stdio: ["ignore", "pipe", "inherit"] }
|
|
3747
|
-
);
|
|
3757
|
+
const child = spawn("npx", ["--yes", WRANGLER, ...args], {
|
|
3758
|
+
stdio: ["ignore", "pipe", "inherit"]
|
|
3759
|
+
});
|
|
3748
3760
|
child.stdout.on("data", (b) => {
|
|
3749
3761
|
text2 += String(b);
|
|
3750
3762
|
});
|
|
3751
3763
|
child.on("close", (code) => resolve7({ code: code ?? 1, text: text2 }));
|
|
3752
3764
|
child.on("error", () => resolve7({ code: 1, text: text2 }));
|
|
3753
3765
|
});
|
|
3754
|
-
|
|
3766
|
+
}
|
|
3767
|
+
function existingNamespace(text2, title) {
|
|
3768
|
+
try {
|
|
3769
|
+
const list2 = JSON.parse(text2.slice(text2.indexOf("[")));
|
|
3770
|
+
return list2.find((n) => n.title === title)?.id ?? null;
|
|
3771
|
+
} catch {
|
|
3772
|
+
return null;
|
|
3773
|
+
}
|
|
3755
3774
|
}
|
|
3756
3775
|
function namespaceId(text2) {
|
|
3757
3776
|
return /\bid\b["']?\s*[:=]\s*["']([0-9a-f]{32})["']/.exec(text2)?.[1] ?? null;
|
|
@@ -7390,7 +7409,7 @@ var REACTIONS = `
|
|
|
7390
7409
|
`;
|
|
7391
7410
|
var TIMELINE_COMMON = `
|
|
7392
7411
|
__typename
|
|
7393
|
-
... on IssueComment { author { login } createdAt body url ${REACTIONS} }
|
|
7412
|
+
... on IssueComment { author { login } createdAt body bodyHTML url ${REACTIONS} }
|
|
7394
7413
|
... on CrossReferencedEvent {
|
|
7395
7414
|
actor { login } createdAt
|
|
7396
7415
|
source {
|
|
@@ -7422,7 +7441,7 @@ var TIMELINE_COMMON = `
|
|
|
7422
7441
|
`;
|
|
7423
7442
|
var TIMELINE_PR = `
|
|
7424
7443
|
... on MergedEvent { actor { login } createdAt commit { oid url } }
|
|
7425
|
-
... on PullRequestReview { author { login } createdAt state body url }
|
|
7444
|
+
... on PullRequestReview { author { login } createdAt state body bodyHTML url }
|
|
7426
7445
|
... on ReadyForReviewEvent { actor { login } createdAt }
|
|
7427
7446
|
... on ReviewRequestedEvent {
|
|
7428
7447
|
actor { login } createdAt
|
|
@@ -7473,7 +7492,7 @@ query($owner:String!, $name:String!, $number:Int!) {
|
|
|
7473
7492
|
issueOrPullRequest(number:$number) {
|
|
7474
7493
|
__typename
|
|
7475
7494
|
... on Issue {
|
|
7476
|
-
number title body url state createdAt updatedAt ${ROW_EXTRAS}
|
|
7495
|
+
number title body bodyHTML url state createdAt updatedAt ${ROW_EXTRAS}
|
|
7477
7496
|
author { login }
|
|
7478
7497
|
${REACTIONS}
|
|
7479
7498
|
labels(first:12) { nodes { name } }
|
|
@@ -7481,7 +7500,7 @@ query($owner:String!, $name:String!, $number:Int!) {
|
|
|
7481
7500
|
timelineItems(last:100, itemTypes:${ISSUE_TYPES}) { nodes { ${TIMELINE_COMMON} } }
|
|
7482
7501
|
}
|
|
7483
7502
|
... on PullRequest {
|
|
7484
|
-
number title body url state createdAt updatedAt isDraft mergeable reviewDecision ${ROW_EXTRAS}
|
|
7503
|
+
number title body bodyHTML url state createdAt updatedAt isDraft mergeable reviewDecision ${ROW_EXTRAS}
|
|
7485
7504
|
author { login }
|
|
7486
7505
|
${REACTIONS}
|
|
7487
7506
|
labels(first:12) { nodes { name } }
|
|
@@ -7550,7 +7569,7 @@ function shape(n, repo, role, kind) {
|
|
|
7550
7569
|
// The list carries the body only to find a decision's default; a row never shows it, and
|
|
7551
7570
|
// a thread that is opened is read whole on its own. A status issue's body is the exception:
|
|
7552
7571
|
// it is the staff member's report, and Home shows it.
|
|
7553
|
-
body: n.timelineItems || isStatus(n) ? n.body ?? "" : "",
|
|
7572
|
+
body: n.timelineItems || isStatus(n) ? signed(n.body ?? "", n.bodyHTML) : "",
|
|
7554
7573
|
...extras(n),
|
|
7555
7574
|
labels: (n.labels?.nodes ?? []).map((l) => l.name),
|
|
7556
7575
|
assignees: (n.assignees?.nodes ?? []).map((a) => a.login),
|
|
@@ -7590,6 +7609,21 @@ function dueOf(body2) {
|
|
|
7590
7609
|
const action = m[2].replace(/[*_"“”]+/g, "").replace(/\.\s*$/, "").trim();
|
|
7591
7610
|
return { date: m[1], action };
|
|
7592
7611
|
}
|
|
7612
|
+
var ASSET_ID = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/;
|
|
7613
|
+
var ASSET_LINK = /https:\/\/github\.com\/(?:user-attachments\/assets|[\w.-]+\/[\w.-]+\/assets\/\d+)\/([0-9a-f-]{36})/g;
|
|
7614
|
+
function signed(body2, html) {
|
|
7615
|
+
if (!html || !body2.includes("github.com/")) return body2;
|
|
7616
|
+
const found = /* @__PURE__ */ new Map();
|
|
7617
|
+
for (const m of html.matchAll(
|
|
7618
|
+
/src="(https:\/\/private-user-images\.githubusercontent\.com\/[^"]+)"/g
|
|
7619
|
+
)) {
|
|
7620
|
+
const src = m[1].replace(/&/g, "&");
|
|
7621
|
+
const id = ASSET_ID.exec(src)?.[0];
|
|
7622
|
+
if (id && !found.has(id)) found.set(id, src);
|
|
7623
|
+
}
|
|
7624
|
+
if (!found.size) return body2;
|
|
7625
|
+
return body2.replace(ASSET_LINK, (link, id) => found.get(id) ?? link);
|
|
7626
|
+
}
|
|
7593
7627
|
function reactions(n) {
|
|
7594
7628
|
return (n.reactionGroups ?? []).filter((g) => (g.reactors?.totalCount ?? 0) > 0).map((g) => ({
|
|
7595
7629
|
content: g.content,
|
|
@@ -7606,7 +7640,7 @@ function event(e) {
|
|
|
7606
7640
|
type: "comment",
|
|
7607
7641
|
actor: who,
|
|
7608
7642
|
createdAt: at,
|
|
7609
|
-
body: e.body ?? "",
|
|
7643
|
+
body: signed(e.body ?? "", e.bodyHTML),
|
|
7610
7644
|
url: e.url,
|
|
7611
7645
|
reactions: reactions(e)
|
|
7612
7646
|
};
|
|
@@ -7666,7 +7700,7 @@ function event(e) {
|
|
|
7666
7700
|
actor: who,
|
|
7667
7701
|
createdAt: at,
|
|
7668
7702
|
state: e.state,
|
|
7669
|
-
body: e.body ?? "",
|
|
7703
|
+
body: signed(e.body ?? "", e.bodyHTML),
|
|
7670
7704
|
url: e.url
|
|
7671
7705
|
};
|
|
7672
7706
|
case "ReadyForReviewEvent":
|
|
@@ -8552,7 +8586,16 @@ var DOCS = /* @__PURE__ */ new Set(["/api/docs", "/api/docsearch", "/api/doc", "
|
|
|
8552
8586
|
function isPortalRoute(path) {
|
|
8553
8587
|
return Object.hasOwn(ROUTES, path);
|
|
8554
8588
|
}
|
|
8589
|
+
var localLogin = null;
|
|
8555
8590
|
var ROUTES = {
|
|
8591
|
+
/* A hosted portal answers this before it gets here. On your own machine it is whoever your
|
|
8592
|
+
`gh` is signed in as, so Home can show you what is yours. */
|
|
8593
|
+
"/api/session": async ({ actor }) => {
|
|
8594
|
+
localLogin ??= actor.gh.graphql("query { viewer { login } }").then((r) => r.ok ? r.data?.viewer?.login ?? "" : "").catch(() => "");
|
|
8595
|
+
const login = await localLogin;
|
|
8596
|
+
if (!login) localLogin = null;
|
|
8597
|
+
return json({ login, hosted: false });
|
|
8598
|
+
},
|
|
8556
8599
|
/* The docs ship with the framework, so they are served from there rather than the tenant. */
|
|
8557
8600
|
"/api/docs": async () => json(docPages()),
|
|
8558
8601
|
"/api/docsearch": async ({ url }) => json({ hits: searchDocs(url.searchParams.get("q") ?? "") }),
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
compose,
|
|
4
|
+
handlesList,
|
|
4
5
|
humanSentence,
|
|
5
6
|
parseYaml,
|
|
6
7
|
readHumans,
|
|
7
8
|
render
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JH3LQ34C.js";
|
|
9
10
|
export {
|
|
10
11
|
compose,
|
|
12
|
+
handlesList,
|
|
11
13
|
humanSentence,
|
|
12
14
|
parseYaml,
|
|
13
15
|
readHumans,
|
|
@@ -133,6 +133,10 @@ button.ghbtn:hover{background:color-mix(in srgb,var(--surface-2) 88%,var(--ink)
|
|
|
133
133
|
.ghbtn.primary{background:var(--accent);border-color:transparent;color:var(--accent-ink);font-weight:600}
|
|
134
134
|
.ghbtn.primary:hover{background:var(--accent);color:var(--accent-ink);opacity:.88}
|
|
135
135
|
.ghbtn:disabled{opacity:.45;cursor:default}
|
|
136
|
+
/* Something that ends a thing: light red, so it is never mistaken for the way forward. */
|
|
137
|
+
.ghbtn.danger{color:var(--err);background:color-mix(in srgb,var(--err) 10%,transparent);
|
|
138
|
+
border-color:color-mix(in srgb,var(--err) 28%,transparent)}
|
|
139
|
+
button.ghbtn.danger:hover{color:var(--err);background:color-mix(in srgb,var(--err) 17%,transparent)}
|
|
136
140
|
.iconbtn{background:var(--surface-2);border:1px solid transparent;color:var(--ink-dim);
|
|
137
141
|
border-radius:8px;width:34px;height:34px;cursor:pointer;font-size:15px;line-height:1;
|
|
138
142
|
transition:background .15s var(--ease),color .15s var(--ease)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Home: what needs you,
|
|
1
|
+
/* Home: who is working, what needs you, progress, your requests, closed today. */
|
|
2
2
|
|
|
3
3
|
.home{max-width:820px;margin-top:22px}
|
|
4
4
|
/* The placeholder lines up with the title, as the cards that replace it do. */
|
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
.home h2 .pill{font-size:10.5px}
|
|
12
12
|
.homeempty{color:var(--ink-faint);font-size:13px;margin:0 0 8px}
|
|
13
13
|
|
|
14
|
-
.homeaskcard{display:flex;flex-direction:column;gap:10px}
|
|
14
|
+
.homeaskcard{display:flex;flex-direction:column;gap:10px;margin-top:14px}
|
|
15
|
+
.home .homeasktitle{margin:0;font:600 15px var(--sans);color:var(--ink);letter-spacing:-.01em}
|
|
16
|
+
.homeaskto{gap:8px}
|
|
17
|
+
.homeaskto label{font:500 12.5px var(--sans);color:var(--ink-dim)}
|
|
15
18
|
.homeask,.homeanswer{width:100%;box-sizing:border-box;resize:vertical;min-height:44px;
|
|
16
19
|
font:13px/1.45 var(--sans);color:var(--ink);background:var(--surface-2);
|
|
17
20
|
border:1px solid transparent;border-radius:8px;padding:8px 10px}
|
|
@@ -51,25 +54,12 @@
|
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
.homeworking{display:flex;flex-direction:column;padding:4px 16px}
|
|
54
|
-
.homerun{display:grid;grid-template-columns:minmax(150px,220px) auto 1fr auto;align-items:center;
|
|
55
|
-
gap:12px;padding:12px 0;font-size:13.5px}
|
|
56
|
-
.homerun + .homerun{border-top:1px solid var(--line)}
|
|
57
|
-
.homewho2{display:inline-flex;align-items:center;gap:8px;min-width:0}
|
|
58
|
-
.homewho2 b{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
59
|
-
.homewho2 .ic{--ic:15px;color:var(--ink-dim);flex:none}
|
|
60
|
-
.homestate{justify-self:start}
|
|
61
|
-
.homestate.ok::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;
|
|
62
|
-
margin-right:6px;animation:homepulse 1.6s var(--ease) infinite}
|
|
63
|
-
@keyframes homepulse{50%{opacity:.3}}
|
|
64
|
-
@media (prefers-reduced-motion:reduce){.homestate.ok::before{animation:none}}
|
|
65
57
|
.homerunwhat{color:var(--ink);line-height:1.45;min-width:0}
|
|
66
58
|
.homerunsub{color:var(--ink-dim);font-size:12.5px;margin-top:2px}
|
|
67
59
|
.homerunlog .ghbtn{min-height:28px;padding:3px 12px}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
.homerun .homerunwhat{grid-area:what}.homerun .homerunlog{grid-area:log}
|
|
72
|
-
}
|
|
60
|
+
.homewho2{display:inline-flex;align-items:center;gap:8px;min-width:0}
|
|
61
|
+
.homewho2 b{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
62
|
+
.homewho2 .ic{--ic:15px;color:var(--ink-dim);flex:none}
|
|
73
63
|
|
|
74
64
|
.homerest{margin-top:26px}
|
|
75
65
|
.homeneed.gone,.homeline.gone{opacity:0;transform:translateX(12px);
|
|
@@ -81,26 +71,100 @@
|
|
|
81
71
|
.unread .homeopen,.unread .homerowtitle{font-weight:700}
|
|
82
72
|
|
|
83
73
|
|
|
84
|
-
|
|
85
|
-
.
|
|
86
|
-
|
|
87
|
-
.
|
|
88
|
-
.
|
|
89
|
-
.
|
|
90
|
-
.
|
|
91
|
-
.
|
|
92
|
-
.
|
|
93
|
-
|
|
94
|
-
.
|
|
74
|
+
/* Progress: a card per staff member. Status and one line, then Done and Next side by side. */
|
|
75
|
+
.homereports{display:flex;flex-direction:column;gap:12px}
|
|
76
|
+
.homereport{display:flex;flex-direction:column;gap:10px;font-size:13px;line-height:1.5}
|
|
77
|
+
.homereporthead{display:flex;align-items:center;flex-wrap:wrap;gap:8px 10px}
|
|
78
|
+
.homereportstatus{font-weight:600}
|
|
79
|
+
.homereportstatus.ok{color:var(--accent);background:var(--accent-soft)}
|
|
80
|
+
.homereportwhen{margin-left:auto}
|
|
81
|
+
.homereportline{font-size:14px;color:var(--ink)}
|
|
82
|
+
.homereportline p{margin:0}
|
|
83
|
+
.homereportcols{display:grid;grid-template-columns:1fr 1fr;gap:6px 22px}
|
|
84
|
+
.homereportcol h3{margin:0 0 4px;font:600 11.5px var(--sans);color:var(--ink-dim);
|
|
85
|
+
text-transform:uppercase;letter-spacing:.04em}
|
|
86
|
+
.homereportcol ul{margin:0;padding-left:18px}
|
|
87
|
+
.homereportcol li{margin:0 0 3px;color:var(--ink)}
|
|
88
|
+
.homereportcol li p{margin:0}
|
|
89
|
+
.homereportcol .meta{margin:2px 0 0}
|
|
90
|
+
.homereportneeds{margin:0;font-size:12.5px;color:var(--warn)}
|
|
91
|
+
.homereportbody{min-width:0}
|
|
92
|
+
.homereportbody.fade{max-height:6em;overflow:hidden;
|
|
95
93
|
-webkit-mask-image:linear-gradient(#000 55%,transparent);mask-image:linear-gradient(#000 55%,transparent)}
|
|
96
|
-
.
|
|
94
|
+
.homereportbody p{margin:0 0 6px}
|
|
95
|
+
.homereportbody a,.homereportcol a,.homereportline a{color:var(--accent)}
|
|
97
96
|
.homereportissue{border:0;background:none;padding:0;font:inherit;color:var(--accent);cursor:pointer}
|
|
98
97
|
.homereportissue:hover{text-decoration:underline}
|
|
99
|
-
.
|
|
100
|
-
.
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
.homereportacts{gap:8px}
|
|
99
|
+
.homereportacts .ghbtn{min-height:28px;padding:3px 12px;font-size:12.5px}
|
|
100
|
+
@media (max-width:640px){
|
|
101
|
+
.homereportcols{grid-template-columns:1fr}
|
|
102
|
+
.homereportwhen{margin-left:0;flex-basis:100%}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Yours / Everyone's, beside the Needs you heading. */
|
|
106
|
+
.homescope{display:inline-flex;margin-left:auto;background:var(--surface-2);border-radius:8px;padding:2px}
|
|
107
|
+
.homescope button{border:0;background:none;cursor:pointer;font:500 12px var(--sans);color:var(--ink-dim);
|
|
108
|
+
padding:4px 10px;border-radius:6px}
|
|
109
|
+
.homescope button.on{background:var(--panel);color:var(--ink);box-shadow:var(--shadow-sm)}
|
|
110
|
+
.homefor{color:var(--blue);font-weight:600}
|
|
111
|
+
|
|
112
|
+
/* ---------- the team: an orb per staff member ----------
|
|
113
|
+
Lit and moving is somebody at work, still and grey is somebody free. Each has a colour of
|
|
114
|
+
their own, so two at work side by side are told apart. */
|
|
115
|
+
.hometeam{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px}
|
|
116
|
+
.orbcard{display:flex;flex-direction:column;align-items:center;text-align:center;gap:3px;
|
|
117
|
+
padding:20px 14px 16px;background:var(--panel);border:1px solid var(--line);border-radius:var(--r-lg);
|
|
118
|
+
box-shadow:var(--shadow-sm);transition:border-color .3s var(--ease)}
|
|
119
|
+
.orbcard.busy{border-color:color-mix(in srgb,var(--hue) 40%,var(--line))}
|
|
120
|
+
.orbcard.homeclick{cursor:pointer}
|
|
121
|
+
.orbcard.homeclick:hover .orbname{text-decoration:underline}
|
|
122
|
+
.orbcard:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
|
|
123
|
+
.orb{position:relative;width:76px;height:76px;margin-bottom:10px}
|
|
124
|
+
.orbglow{position:absolute;inset:-16px;border-radius:50%;opacity:0;
|
|
125
|
+
background:radial-gradient(circle,color-mix(in srgb,var(--hue) 55%,transparent) 0,transparent 68%)}
|
|
126
|
+
.orbbody{position:absolute;inset:0;border-radius:50%;overflow:hidden;
|
|
127
|
+
background:radial-gradient(circle at 32% 26%,rgba(255,255,255,.9) 0 5%,
|
|
128
|
+
color-mix(in srgb,var(--hue) 50%,#fff) 16%,var(--hue) 46%,color-mix(in srgb,var(--hue) 50%,#000) 100%);
|
|
129
|
+
box-shadow:inset 0 -8px 16px rgba(0,0,0,.28),0 8px 22px color-mix(in srgb,var(--hue) 30%,transparent);
|
|
130
|
+
transition:filter .5s var(--ease),opacity .5s var(--ease)}
|
|
131
|
+
.orbswirl{position:absolute;inset:-35%;opacity:0;mix-blend-mode:screen;filter:blur(7px);
|
|
132
|
+
background:conic-gradient(from 0deg,transparent 0 12%,rgba(255,255,255,.55) 20%,transparent 32% 58%,
|
|
133
|
+
rgba(255,255,255,.4) 68%,transparent 80%)}
|
|
134
|
+
.orbicon{position:absolute;inset:0;display:grid;place-items:center;color:#fff;
|
|
135
|
+
filter:drop-shadow(0 1px 2px rgba(0,0,0,.35))}
|
|
136
|
+
.orbicon .ic{--ic:24px}
|
|
137
|
+
.orbname{font:600 14px var(--sans);color:var(--ink);letter-spacing:-.01em}
|
|
138
|
+
.orbstate{font:600 12px var(--sans);color:var(--ink-faint)}
|
|
139
|
+
.orbline{font:12.5px/1.45 var(--sans);color:var(--ink-dim);max-width:100%;overflow:hidden;
|
|
140
|
+
display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
|
|
141
|
+
.orblog{margin-top:6px;font:12px var(--sans);color:var(--ink-faint)}
|
|
142
|
+
.orblog:hover{color:var(--accent)}
|
|
103
143
|
|
|
144
|
+
.orbcard.busy .orbstate{color:color-mix(in srgb,var(--hue) 80%,var(--ink))}
|
|
145
|
+
.orbcard.busy .orbglow{animation:orbbreathe 2.6s ease-in-out infinite}
|
|
146
|
+
.orbcard.busy .orbswirl{opacity:1;animation:orbspin 5s linear infinite}
|
|
147
|
+
.orbcard.busy .orbbody{animation:orbfloat 3.2s ease-in-out infinite}
|
|
148
|
+
.orbcard.queued .orbglow{animation:orbbreathe 1.4s ease-in-out infinite}
|
|
149
|
+
.orbcard.queued .orbswirl{opacity:.6;animation:orbspin 9s linear infinite}
|
|
150
|
+
.orbcard.queued .orbstate{color:var(--warn)}
|
|
151
|
+
/* Free: the same orb, still and drained of colour. */
|
|
152
|
+
.orbcard.idle .orbbody,.orbcard.failed .orbbody,.orbcard.wait .orbbody{filter:saturate(.12) brightness(.95);opacity:.6}
|
|
153
|
+
.orbcard.failed .orb::after{content:"";position:absolute;top:4px;right:4px;width:12px;height:12px;border-radius:50%;
|
|
154
|
+
background:var(--err);box-shadow:0 0 0 3px var(--panel)}
|
|
155
|
+
.orbcard.wait .orbbody{animation:orbbreathe 1.6s ease-in-out infinite}
|
|
156
|
+
@keyframes orbbreathe{0%,100%{opacity:.35;transform:scale(.92)}50%{opacity:1;transform:scale(1.06)}}
|
|
157
|
+
@keyframes orbspin{to{transform:rotate(360deg)}}
|
|
158
|
+
@keyframes orbfloat{0%,100%{transform:translateY(0)}50%{transform:translateY(-3px)}}
|
|
159
|
+
@media (prefers-reduced-motion:reduce){
|
|
160
|
+
.orbcard .orbglow,.orbcard .orbswirl,.orbcard .orbbody{animation:none!important}
|
|
161
|
+
.orbcard.busy .orbglow{opacity:.8}
|
|
162
|
+
}
|
|
163
|
+
@media (max-width:640px){
|
|
164
|
+
.hometeam{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
|
|
165
|
+
.orbcard{padding:16px 10px 12px}
|
|
166
|
+
.orb{width:64px;height:64px}
|
|
167
|
+
}
|
|
104
168
|
|
|
105
169
|
/* Rows in a list card (Unread, Your requests, Closed today) that open a thread. */
|
|
106
170
|
.homeline{display:grid;grid-template-columns:8px minmax(0,1fr) auto;align-items:center;gap:4px 14px;
|
|
@@ -69,6 +69,17 @@
|
|
|
69
69
|
.chead .clogin{font:11.5px var(--mono);color:var(--ink-faint)}
|
|
70
70
|
.chead .cwhen{margin-left:auto;font-size:12px;color:var(--ink-faint);white-space:nowrap}
|
|
71
71
|
.cbodywrap{padding:12px 16px 14px}
|
|
72
|
+
/* The newest message in a thread: what you opened it to read. */
|
|
73
|
+
.cmt.latest{border-color:color-mix(in srgb,var(--blue) 55%,var(--line));
|
|
74
|
+
box-shadow:0 0 0 3px color-mix(in srgb,var(--blue) 12%,transparent)}
|
|
75
|
+
.cmt.latest .chead{background:color-mix(in srgb,var(--blue) 9%,var(--panel-2))}
|
|
76
|
+
.chead .clatest{color:var(--blue);background:color-mix(in srgb,var(--blue) 14%,transparent);
|
|
77
|
+
font:600 10.5px var(--sans);margin-left:2px}
|
|
78
|
+
/* Everything between the newest message and the opening post, folded. */
|
|
79
|
+
.tearlierbtn{display:block;width:100%;margin:6px 0;padding:9px 12px;cursor:pointer;
|
|
80
|
+
font:500 12.5px var(--sans);color:var(--ink-dim);background:var(--panel-2);
|
|
81
|
+
border:1px dashed var(--line);border-radius:var(--r)}
|
|
82
|
+
.tearlierbtn:hover{color:var(--ink);border-color:var(--border-strong)}
|
|
72
83
|
/* The header already draws a line under itself. Whatever the reversed thread puts first must
|
|
73
84
|
not draw a second one right under it. */
|
|
74
85
|
.lead{border-top:0}
|
|
@@ -103,6 +103,7 @@ export async function boot() {
|
|
|
103
103
|
the thing that fixes it. */
|
|
104
104
|
const [first, session] = await Promise.all([loadWithProgress(), getSession()]);
|
|
105
105
|
S.hosted = session?.hosted ? session : null;
|
|
106
|
+
S.me = session?.login || null;
|
|
106
107
|
if (S.hosted) showSignedIn(S.hosted.login);
|
|
107
108
|
if (first && first.mode === "setup") {
|
|
108
109
|
document.body.dataset.setup = "1";
|
|
@@ -80,6 +80,7 @@ export function sortHome(items, staff, humans, live = [], now = new Date()) {
|
|
|
80
80
|
? "answered"
|
|
81
81
|
: "waiting";
|
|
82
82
|
}
|
|
83
|
+
if (place.place === "needs") entry.for = whoFor(item, humans);
|
|
83
84
|
out[place.place].push(entry);
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -126,6 +127,25 @@ export function placeOf(item, owner, people, markers) {
|
|
|
126
127
|
};
|
|
127
128
|
}
|
|
128
129
|
|
|
130
|
+
/**
|
|
131
|
+
* The people an ask is on, by login: whoever it is assigned to, and whoever's label it carries.
|
|
132
|
+
* Empty means nobody in particular, such as a pull request nobody was asked to look at, and then
|
|
133
|
+
* it is everybody's.
|
|
134
|
+
*/
|
|
135
|
+
export function whoFor(item, humans) {
|
|
136
|
+
const labels = new Set((item.labels ?? []).map(lower));
|
|
137
|
+
const assigned = new Set((item.assignees ?? []).map(lower));
|
|
138
|
+
return humans
|
|
139
|
+
.filter((h) => (h.github && assigned.has(lower(h.github))) || (h.marker && labels.has(lower(h.marker))))
|
|
140
|
+
.map((h) => h.github);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Whether an ask is for this login: it is on them, or on nobody in particular. */
|
|
144
|
+
export function isFor(entry, login) {
|
|
145
|
+
if (!login || !entry.for?.length) return true;
|
|
146
|
+
return entry.for.some((g) => lower(g) === lower(login));
|
|
147
|
+
}
|
|
148
|
+
|
|
129
149
|
function kindOf(labels) {
|
|
130
150
|
const found = KINDS.find((k) => labels.includes(k));
|
|
131
151
|
if (found) return found;
|
|
@@ -64,8 +64,13 @@ function htmlToMarkdown(html, breakAs, stripUnknown) {
|
|
|
64
64
|
.replace(/<(strong|b)[^>]*>([\s\S]*?)<\/\1>/gi, (_m, _t, x) => "**" + x.trim() + "**")
|
|
65
65
|
.replace(/<(em|i)[^>]*>([\s\S]*?)<\/\1>/gi, (_m, _t, x) => "*" + x.trim() + "*")
|
|
66
66
|
.replace(/<code[^>]*>([\s\S]*?)<\/code>/gi, (_m, x) => "`" + x.trim() + "`")
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
/* A screenshot dragged into an issue on GitHub is written as an <img> tag, not as markdown,
|
|
68
|
+
and dropping it to its alt text left the word "Image" where the picture was. */
|
|
69
|
+
.replace(/<img[^>]*>/gi, (tag) => {
|
|
70
|
+
const src = /\ssrc=["'](https?:\/\/[^"'\s]+)["']/i.exec(tag)?.[1];
|
|
71
|
+
const alt = (/\salt=["']([^"']*)["']/i.exec(tag)?.[1] ?? "").replace(/[[\]]/g, "");
|
|
72
|
+
return src ? "" : alt;
|
|
73
|
+
})
|
|
69
74
|
// Only http(s). A `javascript:` href would be escaped downstream anyway, but a link that
|
|
70
75
|
// cannot go anywhere useful is better dropped than rendered.
|
|
71
76
|
.replace(
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { getInbox, getOrg, getSync } from "./api.js";
|
|
11
11
|
import { $, ago, el, esc } from "./dom.js";
|
|
12
12
|
import { render } from "./router.js";
|
|
13
|
-
import { sortHome } from "./homesort.js";
|
|
13
|
+
import { isFor, sortHome } from "./homesort.js";
|
|
14
14
|
import { humansOf, openCount, S, unreadCount } from "./state.js";
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -75,7 +75,9 @@ export function stampCounts() {
|
|
|
75
75
|
/** What Home's "Needs you" holds, for the sidebar. */
|
|
76
76
|
function needsCount() {
|
|
77
77
|
if (!S.inbox || !S.data) return 0;
|
|
78
|
-
return sortHome(S.inbox.items ?? [], S.data.staff, humansOf(), S.live?.staff ?? []).needs.
|
|
78
|
+
return sortHome(S.inbox.items ?? [], S.data.staff, humansOf(), S.live?.staff ?? []).needs.filter(
|
|
79
|
+
(e) => isFor(e, S.me),
|
|
80
|
+
).length;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
export function countInBackground() {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* A staff member's report, the body of their status issue, taken apart for Home's card. */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A report, taken apart: the status line, and the Done, Working on, Needs you and Next
|
|
5
|
+
* sections the prompts ask for. A report written before that shape has none of them, and is
|
|
6
|
+
* shown as its opening lines instead.
|
|
7
|
+
*/
|
|
8
|
+
export function parseReport(body) {
|
|
9
|
+
const lines = String(body ?? "").replace(/\r/g, "").split("\n");
|
|
10
|
+
const out = { status: "", headline: "", sections: {} };
|
|
11
|
+
let at = null;
|
|
12
|
+
const intro = [];
|
|
13
|
+
for (const raw of lines) {
|
|
14
|
+
const line = raw.trim();
|
|
15
|
+
const h = /^#{2,3}\s+(.+?)\s*$/.exec(line);
|
|
16
|
+
if (h) {
|
|
17
|
+
at = sectionKey(h[1]);
|
|
18
|
+
if (at) out.sections[at] ??= [];
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (!at) {
|
|
22
|
+
if (/^_?updated\b/i.test(line)) continue;
|
|
23
|
+
const st = /^\**status:\s*(on track|needs you|stuck|blocked)\b[.!]?\**\s*[.:\u2013\u2014-]?\s*(.*)$/i.exec(line);
|
|
24
|
+
if (st && !out.status) {
|
|
25
|
+
out.status = st[1].trim().toLowerCase();
|
|
26
|
+
if (st[2]) out.headline = st[2].replace(/^\**\s*/, "").trim();
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (line) intro.push(line);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const item = /^[-*]\s+(.*)$/.exec(line) ?? /^\d+[.)]\s+(.*)$/.exec(line);
|
|
33
|
+
if (item) out.sections[at].push(item[1]);
|
|
34
|
+
else if (line && out.sections[at].length) out.sections[at][out.sections[at].length - 1] += " " + line;
|
|
35
|
+
else if (line) out.sections[at].push(line);
|
|
36
|
+
}
|
|
37
|
+
if (!out.headline && intro.length) out.headline = intro[0];
|
|
38
|
+
for (const k of Object.keys(out.sections)) {
|
|
39
|
+
out.sections[k] = out.sections[k].filter((x) => !/^nothing\.?$/i.test(x.trim()));
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function sectionKey(title) {
|
|
45
|
+
const t = title.toLowerCase();
|
|
46
|
+
if (/^(done|shipped|finished|completed)/.test(t)) return "done";
|
|
47
|
+
if (/^(working on|priorities|in progress)/.test(t)) return "working";
|
|
48
|
+
if (/^(needs you|on you|waiting on)/.test(t)) return "needs";
|
|
49
|
+
if (/^next/.test(t)) return "next";
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
@@ -42,6 +42,8 @@ export const S = {
|
|
|
42
42
|
data: null,
|
|
43
43
|
/** `{login}` on a hosted portal, null on your own machine. Hosted has no setup, hire or doctor. */
|
|
44
44
|
hosted: null,
|
|
45
|
+
/** The signed-in GitHub login, hosted or local. Null when it could not be read. */
|
|
46
|
+
me: null,
|
|
45
47
|
docs: null,
|
|
46
48
|
inbox: null,
|
|
47
49
|
/** /api/runs. Kept once read: it is minutes of downloads on a cold cache. */
|